Skip to main content

Module Aliases

Catalyst supports module aliases to create shorter and more descriptive import paths for modules. This practice can make the codebase cleaner and more maintainable. Some module aliases come pre-configured when setting up Catalyst, making imports cleaner.

Example

// without aliasing
import Input from '../../../components/Input'
// with aliasing
import Input from '@components/Input'

To create module aliases, add _moduleAliases key to package.json , shown as below.

package.json
  "_moduleAliases": {
"@api": "api.js",
"@containers": "src/js/containers",
"@server": "server",
"@config": "config",
"@css": "src/static/css",
"@routes": "src/js/routes/",
"@store": "src/js/store/index.js"
},